package vip.xiaonuo.smzq.modular.kcl.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.Kczycllzbmdyb;
import vip.xiaonuo.smzq.modular.kcl.service.IKczycllzbmdybService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 矿产资源储量总量类型编码对应表
 *
 * @author eomer
 * @since 2024-02-22
 */
@Api(tags = "矿产资源储量总量类型编码对应表")
@RestController
@RequestMapping("/kcl/kczycllzbmdyb")
@Validated
public class KczycllzbmdybController {

    @Resource
    private IKczycllzbmdybService iKczycllzbmdybService;

    /**
     * 添加矿产资源储量总量类型编码对应表
     */
    @ApiOperation("添加矿产资源储量总量类型编码对应表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Kczycllzbmdyb kczycllzbmdyb) {
        iKczycllzbmdybService.save(kczycllzbmdyb);
        return CommonResult.ok();
    }

    /**
     * 删除矿产资源储量总量类型编码对应表
     */
    @ApiOperation("删除矿产资源储量总量类型编码对应表")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iKczycllzbmdybService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑矿产资源储量总量类型编码对应表
     */
    @ApiOperation("编辑矿产资源储量总量类型编码对应表")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Kczycllzbmdyb kczycllzbmdyb) {
        iKczycllzbmdybService.updateById(kczycllzbmdyb);
        return CommonResult.ok();
    }

    /**
     * 矿产资源储量总量类型编码对应表分页查询
     */
    @ApiOperation("矿产资源储量总量类型编码对应表分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Kczycllzbmdyb>> page() {
        return CommonResult.data(iKczycllzbmdybService.page(new Kczycllzbmdyb()));
    }
}
